<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, res-scalable=no" />
    <meta name="renderer" content="webkit">
    <title></title>  
    <link rel="stylesheet" href="__CSS__/pintuer.css">
    <link rel="stylesheet" href="__CSS__/admin.css">
    <script src="__JS__/jquery.js"></script>
    <script src="__JS__/pintuer.js"></script>
</head>
<body>
<form method="get" action="/res/rec">
  <div class="panel admin-panel">
    <div class="panel-head"><strong class="icon-reorder">回复回收管理</strong></div>
    <div class="padding border-bottom">
      <ul class="search">
      <li style="float:right;">
          <a class="button border-main icon-plus-square-o" href="/res/rec/add"> 添加内容</a>
          <input type="text" placeholder="请输入搜索关键字" value="{$_GET['keyword']??''}" name="keyword" class="input" style="width:250px; line-height:17px;display:inline-block" />
          <a href="javascript:void(0)" class="button border-main icon-search" onclick="$('form').submit()"> 搜索</a>
      </li>
      </ul>
    </div>
    <table class="table table-hover text-center">
      <tr>
        <th width="120">id</th>
        <th>回复内容</th>
        <th width="240">昵称</th>
        <th>回复时间</th>
        <th>操作</th>
      </tr>
        {volist name='list' id='res'}
        <tr>
          <td><input type="checkbox" name="id[]" value="{$res.r_id}" />
              {$res.r_id}</td>
          <td>{$res.r_content}</td>
          <td>{$res.r_unick}</td>
          <td>{$res.r_createat}</td>
          <td>
            <div class="button-group"><a class="button border-green" href="javascript:void(0)" onclick="return recovery({$res.r_id})"><span class="icon-recycle"></span>恢复</a></div>
            <div class="button-group"><a class="button border-red" href="javascript:void(0)" onclick="return del({$res.r_id})"><span class="icon-edit"></span>直接删除</a></div>
          </td>
        </tr>
        {/volist}
      {if $page}
      <tr>
        <td colspan="8" class="pagelist">{$page|raw}</td>
      </tr>
      {/if}
    </table>
  </div>
</form>
<script>
    function del(id){
        if(confirm("您确定要删除吗?")){
            $.getJSON('/res/rec/delete', {rid:id}, function(response) {
                if (response.rs) {
                    alert("删除成功!");
                    window.location.reload();
                }
            })
        }
    }

    function recovery(id) {
        if(confirm("您确定要恢复吗?")){
            $.getJSON('/res/rec/normal', {rid:id}, function(response) {
                if (response.rs) {
                    alert("恢复成功!");
                    window.location.reload();
                }
            })
        }
    }
</script>
</body></html>